import org.junit.Test;
import utilities.DataSourceUtils;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class C3p0Select {

    @Test
    public void c3p0Select() throws SQLException {

        Connection connection = DataSourceUtils.getConnection();
        String sql = "SELECT * FROM products";
        Statement statement = connection.createStatement();

        ResultSet resultSet = statement.executeQuery(sql);
        while (resultSet.next()) {
            System.out.println(resultSet.getString(2) + "\t");
        }
        //6.关闭jdbc连接
        statement.close();
        connection.close();
    }
}
